package cn.com.aidl;

import com.topvision.gsj.library.constant.PushConstant;
import com.topvision.gsj.library.util.FileUtil;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.os.RemoteException;
import android.util.Log;

public class VoiceService extends Service {
	private ServiceBinder serviceBinder = new ServiceBinder();
	public static String ACTION_INTENT_TEST = "";
	public static String VOICE_ACTION = "VOICE_ACTION";
	public static final String VOICE_DATA = "VOICE_DATA";
	public final String HEAD_ACTIVITY = "com.topvision.gsj.headtrack.HeadActivity";

	@Override
	public IBinder onBind(Intent arg0) {
		Log.d("SmartVoice", "onBind.........");
		return serviceBinder;
	}

	public class ServiceBinder extends IVoiceService.Stub {

		@Override
		public void onReceive(String voice) throws RemoteException {
			Log.d("SmartVoice", voice);
//			if(voice.startsWith("update:")){
//				String appName = voice.split(":")[1];
//				String url = PushConstant.SERVER_IP+appName+".apk";
//				FileUtil.downFile(url);
//			}else{
				Intent intent = new Intent(VOICE_ACTION);
				intent.putExtra(VOICE_DATA, voice);
				sendBroadcast(intent);
//			}
				

		}
	}

	

}
